package task_C;

import java.sql.*;

/**
 * @author 86136
 */
public class QueryQuestionBank {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        Class.forName("com.mysql.cj.jdbc.Driver");
        Connection conn= DriverManager.getConnection("jdbc:mysql://localhost:3306/latask","root","Aa1269630309");
        String sql="select * from question_bank;";
        Statement stmt=conn.createStatement();
        ResultSet rs = stmt.executeQuery(sql);
        while (rs.next()){
            int id = rs.getInt(1);
            String type = rs.getString(2);
            String question = rs.getString(3);
            String option = rs.getString(4);
            String answer = rs.getString(5);
            System.out.println(id+" "+type+" "+ question+" "+option+" "+answer);
        }
        rs.close();
        stmt.close();
        conn.close();
    }
}
